<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>涛宝商城---后台管理系统</title>
		<link rel="stylesheet" type="text/css" th:href="@{appstyle/css/mdui.css}" />
		<script th:src="@{appstyle/js/jquery-3.3.1.js}" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" th:src="@{appstyle/js/mdui.js}"></script>
	</head>
	<body class="mdui-theme-primary-indigo mdui-theme-accent-pink" style="background: #F5F5F5;">
		<div class="mdui-container" style="width: 600px;position: absolute;left:33%;bottom: 55%;background: #FFFFFF;">
			<div id="header" style="width: 100%;height:50px;position: relative;left: 100px;">
				<h1>涛宝商城---后台管理系统</h1>
			</div>
			<div id="body">
				<div class="mdui-textfield" style="width: 500px;margin:0 auto">
					<i class="mdui-icon material-icons">account_circle</i>
					<label class="mdui-textfield-label">User Name</label>
					<input id="username" class="mdui-textfield-input" type="text" />
				</div>
				<div class="mdui-textfield" style="width: 500px;margin:0 auto">
					<i class="mdui-icon material-icons">&#xe8f9;</i>
					<label class="mdui-textfield-label">User Password</label>
					<input id="password" class="mdui-textfield-input" type="text" />
				</div>
				<div class="mdui-textfield" style="height:50px;margin:0 auto">
				<button id="loginBtn" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent"  mdui-tooltip="{content: '登录系统'}" style="position: absolute;left: 50px;width: 500px;">Login</button>
				</div>
			</div>
		</div>
		<script type="text/javascript">
$(document).ready(function(){
  locationIndex=function(){
	  window.location.href="admin.html";
  }
	// 登录按钮事件:
   $("#loginBtn").click(function(){
	   $.ajax({
		   url:"manage/user/login.do",
		   Type:"post",
		   data:user={
				 username:$("#username").val(),
				 password:$("#password").val(),
		   },
		   dataType:"json",
		   success:function(data){
			   if(data.status==0){
				   mdui.snackbar({
					    message: '登录成功',
					    position: 'top',
					    timeout:100
				   });
				   var timeCount = 3;
				   countDown=function(){
					   if(timeCount==-1){
						   window.location.href="index.html";
					   }
					   mdui.snackbar({
						    message: "登录成功,"+timeCount+"秒自动后跳转:<a onclick='locationIndex()'>点击立刻登录</a>",
						    position: 'top',
						    timeout:1000
					   });
					   timeCount--;
				   } 
				   setInterval("countDown()", 1000);
			   }else{
				   mdui.snackbar({
					    message: data.msg,
					    position: 'top',
					    timeout:3000
				   });
			   }
		   }
	   })
   })
})
</script>
	</body>
</html>